<?  include('../includes/loader.inc.php'); 

	if (!$Usuario->logged()) {
		header("Location: /admin"); exit;
	}

	// Pido todos los suscriptos
	$out = '';
	if ($newsletter = $db->get_col("SELECT mail FROM newsletter"))
		$out = implode("\n", $newsletter);

	// Envio los encabezados de descarga
	header('Content-Type: application/vnd.ms-excel');
	header('Content-Disposition: attachment; filename="Newsletter.csv"');
	header("Content-Transfer-Encoding: binary");
	header('Accept-Ranges: bytes');
	header("Cache-control: private");
	header('Pragma: private');
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

	echo $out;
	flush();
	exit;


?>
